package com.wuhao.springboot.controller;

import com.wuhao.springboot.common.Result;
import com.wuhao.springboot.entity.ro.EditRO;
import com.wuhao.springboot.entity.FaultDetection;
import com.wuhao.springboot.entity.ro.AppointRO;
import com.wuhao.springboot.entity.ro.OrderPageRO;
import com.wuhao.springboot.entity.ro.ReceiveRO;
import com.wuhao.springboot.entity.ro.ScoreRO;
import com.wuhao.springboot.entity.vo.OrderPageVO;
import com.wuhao.springboot.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description
 * @Date 2023/1/31 7:33
 * @Author pq
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("/create")
    public Result create(@RequestBody FaultDetection ro){
        orderService.addOrder(ro);
        return Result.success();
    }

    @PostMapping("/page")
    public OrderPageVO page(@RequestBody OrderPageRO ro){
        return orderService.page(ro);
    }

    @PostMapping("/edit")
    public Result edit(@RequestBody EditRO ro){
        orderService.edit(ro);
        return Result.success();
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody EditRO ro){
        orderService.delete(ro);
        return Result.success();
    }

    @PostMapping("/appoint")
    public Result appoint(@RequestBody AppointRO ro){
        orderService.appoint(ro);
        return Result.success();
    }

    @PostMapping("/score")
    public Result score(@RequestBody ScoreRO ro){
        orderService.score(ro);
        return Result.success();
    }

    @PostMapping("/myOrderPage")
    public OrderPageVO myOrderPage(@RequestBody OrderPageRO ro){
        return orderService.myOrderPage(ro);
    }

    @PostMapping("/receive")
    public Result receive(@RequestBody ReceiveRO ro){
        orderService.receive(ro);
        return Result.success();
    }
}
